#include "GeneralUser.h"

GeneralUser::GeneralUser()
{
}

GeneralUser::~GeneralUser()
{
}

void GeneralUser::link(BookingClass* i, Holiday* j, Management* k)
{
    bc = i;
    hol = j;
    mg = k;
}

void GeneralUser::menu(string username)
{
    cout << "Welcome General Manager " << username << " !" << endl
            << "==================================================" << endl << endl;

    bool isExit = false;
    do
    {
        cout << "Please select desired option" << endl << endl
                << "1) Create New Holiday Package" << endl
                << "2) Edit Existing Holiday Package" << endl
                << "3) Delete Holiday Package" << endl
                << "4) Create New Staff Account" << endl
                << "5) Edit Existing Staff Account" << endl
                << "6) Delete Staff Account" << endl
                << "7) View Holiday Package Statistics" << endl
                << "8) Logout" << endl << endl
                << "Your Option: ";

        int opt;
        cin >> opt;
        cin.clear();
        cin.ignore(INT_MAX, '\n');

        switch (opt)
        {
        case 1: option1();
            break;
        case 2: option2();
            break;
        case 3: option3();
            break;
        case 4: option4();
            break;
        case 5: option5();
            break;
        case 6: option6();
            break;
        case 7: option7();
            break;
        case 8: isExit = true;
            break;
        default: cout << "Enter only 1-8 please." << endl;
            break;
        }
    }
    while (isExit == false);
}

void GeneralUser::option1()
{
    cout << endl << "You have selected to create a new holiday package." << endl << endl;
    hol->createPackage();
}

void GeneralUser::option2()
{
    cout << endl << "You have selected to edit an existing holiday package." << endl << endl;
    hol->editPackage();
}

void GeneralUser::option3()
{
    cout << endl << "You have selected to delete a holiday package." << endl << endl;
    hol->deletePackage();
}

void GeneralUser::option4()
{
    cout << endl << "You have selected to create a new staff account." << endl << endl;
    mg->createStaff();
}

void GeneralUser::option5()
{
    cout << endl << "You have selected to edit an existing staff account." << endl << endl;
    mg->editStaff();
}

void GeneralUser::option6()
{
    cout << endl << "You have selected to delete a staff account." << endl << endl;
    mg->deleteStaff();
}

void GeneralUser::option7()
{
    cout << endl << "You have selected to view package statistics." << endl << endl;
    hol->viewStatistics();
}